<template>
    <div class="qqCover">
        qq登录中,请勿刷新页面...
    </div>
</template>

<script>
import {getQQUserInfo} from '@/api/loginApi'
export default {
    name: 'qqLogin',
    mounted() {
        console.log(this.$route,'当前路由');
        getQQUserInfo({code:this.$route.query.code}).then(token=>{
            // console.log('token',token);
            this.$store.dispatch('user/doQQLogin',{token}).then(res=>{
                console.log('router--',res,this.$router);
                let state = sessionStorage.getItem('state')
                let fullPath = JSON.parse(sessionStorage.getItem(state))
                // console.log('fullPath', fullPath);
                sessionStorage.removeItem('state')
                sessionStorage.removeItem(state)
                if(fullPath) {
                    this.$router.push(fullPath.fullPath)
                } else {
                    this.$router.push('/')
                }
            })
        })
    },
    components: {
    }
}
</script>

<style lang="scss">
.qqCover {
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 999;
}
</style>